Skip to content

feat: support extending completed projects in mgw:project#67

Merged
snipcodeit merged 4 commits intomainfrom
issue/55-mgw-project-extend
Feb 27, 2026
Merged

feat: support extending completed projects in mgw:project#67
snipcodeit merged 4 commits intomainfrom
issue/55-mgw-project-extend

Conversation

@snipcodeit
Copy link
Owner

Summary

  • Add project extension flow to /mgw:project — when all milestones are complete, detects this state and offers to extend with new milestones instead of blocking with "Project already initialized"
  • Add mergeProjectState() to lib/state.cjs for append-based milestone merging that preserves existing project data
  • Continue phase numbering from where the last milestone left off and reuse existing GitHub Projects board
  • Document the extend workflow in USER-GUIDE.md

Closes #55

Changes

lib/state.cjs

  • New mergeProjectState(newMilestones, newPhaseMap, newCurrentMilestone) function
  • Loads existing state, appends milestones, merges phase_map (existing keys win), sets current_milestone, writes back

commands/project.md

  • verify_repo: detects all-milestones-complete state, sets EXTEND_MODE=true
  • gather_inputs: in extend mode, loads existing project context, asks only for new milestone scope
  • create_issues: GLOBAL_PHASE_NUM starts at existing phase count (continuation)
  • create_project_board: reuses existing board via project.project_board.number
  • write_project_json: calls mergeProjectState instead of full overwrite in extend mode
  • report: shows "PROJECT EXTENDED" banner with new/total counts
  • success_criteria: updated for extend mode

docs/USER-GUIDE.md

  • "Extending a Completed Project" workflow walkthrough
  • Command reference update for /mgw:project
  • FAQ entry: "How do I add more milestones after completing all of them?"

Test Plan

  • Run /mgw:project on a repo with no project.json — should behave as before (fresh init)
  • Run /mgw:project on a repo with incomplete milestones — should exit with "Project already initialized"
  • Run /mgw:project on a repo with all milestones complete (current_milestone > len(milestones)) — should enter extend mode
  • Verify phase numbering continues from last milestone's max phase number
  • Verify existing GitHub Projects board is reused (not duplicated)
  • Verify mergeProjectState preserves existing milestone data while appending new ones
  • Verify lib/state.cjs still exports all original functions (no regression)

Verification

All 7 must-haves verified against actual codebase:

  1. verify_repo detects all-milestones-complete state
  2. mergeProjectState function exported from lib/state.cjs (arity 3)
  3. Phase numbering continues via EXISTING_PHASE_COUNT offset
  4. Board reused when project.project_board exists
  5. write_project_json uses merge in extend mode
  6. Non-regression: incomplete milestones still exit with "already initialized"
  7. USER-GUIDE.md documents extend workflow (3 sections)

🤖 Generated with Claude Code

Stephen Miller and others added 4 commits February 27, 2026 01:38
- New mergeProjectState(newMilestones, newPhaseMap, newCurrentMilestone) function
- Loads existing project state, appends milestones, merges phase_map
- Preserves all existing data (completed milestones, project config, board)
- Sets current_milestone to point at first new milestone (1-indexed)
- Writes merged state back via writeProjectState
- Exported alongside existing state functions
- verify_repo detects all-milestones-complete via ALL_COMPLETE check
- Sets EXTEND_MODE=true, EXISTING_MILESTONE_COUNT, EXISTING_PHASE_COUNT
- gather_inputs loads existing metadata and asks for new work in extend mode
- create_issues initializes GLOBAL_PHASE_NUM from EXISTING_PHASE_COUNT in extend mode
- create_project_board reuses existing board via project.project_board in extend mode
- write_project_json calls mergeProjectState instead of full write in extend mode
- report shows PROJECT EXTENDED banner in extend mode
- success_criteria includes extend mode criterion
- Non-extend path (Project already initialized exit) preserved
- Add 'Extending a Completed Project' workflow walkthrough section
- Update /mgw:project command reference with extend mode description
- Add FAQ entry 'How do I add more milestones after completing all of them?'
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added documentation Documentation changes slash-commands Changes to slash command files core Changes to core library labels Feb 27, 2026
@snipcodeit
Copy link
Owner Author

Testing Procedures

Prerequisites

  • A repo with MGW initialized and .mgw/project.json present
  • All milestones in the project should be marked complete (all issues at done stage, current_milestone past array length)

Test Steps

1. Fresh Init (regression check)

# In a new repo without .mgw/project.json
/mgw:project
# Expected: normal fresh initialization flow

2. Incomplete Milestones (regression check)

# In a repo with active milestones (current_milestone <= len(milestones))
/mgw:project
# Expected: "Project already initialized. Run /mgw:milestone to continue."

3. Extend Mode (new behavior)

# In a repo where all milestones are done (current_milestone > len(milestones))
/mgw:project
# Expected: detects all complete, prompts for new milestone scope
# Verify: existing milestones preserved, new ones appended
# Verify: phase numbers continue from max existing (not restart at 1)
# Verify: existing GitHub Projects board reused

4. State Integrity

# After extend, check .mgw/project.json
node -e "const s = require('./lib/state.cjs'); console.log(JSON.stringify(s.loadProjectState(), null, 2))"
# Verify: old milestones intact, new milestones appended
# Verify: current_milestone points to first new milestone
# Verify: phase_map merged correctly

5. lib/state.cjs Export Check

node -e "const s = require('./lib/state.cjs'); console.log(Object.keys(s))"
# Expected: all original exports plus mergeProjectState

@snipcodeit snipcodeit merged commit a70bd5a into main Feb 27, 2026
1 check passed
@snipcodeit snipcodeit deleted the issue/55-mgw-project-extend branch February 27, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes to core library documentation Documentation changes slash-commands Changes to slash command files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mgw:project should support extending completed projects

1 participant